Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test: reduce flaky tests #1266

Merged
merged 8 commits into from
Dec 19, 2023
Merged

test: reduce flaky tests #1266

merged 8 commits into from
Dec 19, 2023

Conversation

benjlevesque
Copy link
Contributor

@benjlevesque benjlevesque commented Nov 27, 2023

Resolves #1092

Based on CircleCI insights

Remove unnecessary flaky tests
Replace network calls by mocks
Increase timeouts
Replaced BTC by USD if relevant (for the record, BTC was the only supported currency at first, but now it's legacy and uses an inefficient balance detector)

Comment on lines -95 to -118
describe('Superfluid framework', () => {
it.each([
{ network: 'goerli' },
{ network: 'matic' },
// { network: 'xdai' },
{ network: 'optimism' },
{ network: 'avalanche' },
{ network: 'arbitrum-one' },
] as Array<{ network: CurrencyTypes.EvmChainName }>)(
'Should initialize superfluid framework on $network',
async ({ network }) => {
const provider = getDefaultProvider(network);
const networkValidRequest = {
...validRequest,
currencyInfo: {
...validRequest.currencyInfo,
network,
},
};
const sf = await getSuperFluidFramework(networkValidRequest, provider);
expect(sf).toBeDefined();
},
);
});
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is definitely not a "unit" test. Considering the flakiness it creates, I'm dropping it and not replacing it.

Comment on lines -56 to -80
describeIf(!process.env.CIRCLE_PR_NUMBER && !process.env.DISABLE_API_TESTS, 'Multichain', () => {
// TODO temporary disable xDAI, CELO, Sokol, and Goerli
// FIXME: API-based checks should run nightly and be mocked for CI
[
'mainnet',
// 'rinkeby',
// 'goerli',
// 'xdai',
// 'sokol',
'fuse',
//'celo',
const infoRetriever = new EthInputDataInfoRetriever(
paymentAddress,
PaymentTypes.EVENTS_NAMES.PAYMENT,
'matic',
'fantom',
].forEach((network) => {
it(`Can get the balance on ${network}`, async () => {
const retriever = new EthInputDataInfoRetriever(
'0xc12F17Da12cd01a9CDBB216949BA0b41A6Ffc4EB',
PaymentTypes.EVENTS_NAMES.PAYMENT,
network,
'9649a1a4dd5854ed',
process.env[`EXPLORER_API_KEY_${network.toUpperCase()}`],
);
await expect(retriever.getTransferEvents()).resolves.not.toThrow();
});
});
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

removed this test. This is covered by the first test in terms of logic. The rest isn't "unit" test, but integration, and is too flaky. This is an obsolete feature and doesn't deserve the effort imo

@coveralls
Copy link

coveralls commented Nov 28, 2023

Coverage Status

coverage: 87.105% (-0.03%) from 87.133%
when pulling a2642ac on test/reduce-flaky-tests
into 42ec377 on master.

@benjlevesque benjlevesque marked this pull request as ready for review November 28, 2023 16:02
@benjlevesque benjlevesque requested review from alexandre-abrioux and removed request for yomarion November 29, 2023 09:50
packages/payment-detection/README.md Outdated Show resolved Hide resolved
...args: [string | number | Function | jest.FunctionLike, jest.EmptyFunction]
) => (condition ? describe(...args) : describe.skip(...args));
it('can detect a MATIC payment to self', async () => {
// NB: The from and to are the same
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It might just be me but I always get tripped up by the NB acronym for Nota Bene. I think "Note" would be more clear.

Suggested change
// NB: The from and to are the same
// Note: The from and to are the same

@benjlevesque benjlevesque merged commit fcbf982 into master Dec 19, 2023
25 checks passed
@benjlevesque benjlevesque deleted the test/reduce-flaky-tests branch December 19, 2023 11:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Fix flaky tests
6 participants